package thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author Han
 */
public class FutrueDemo {
	public static void main(String[] args) throws InterruptedException, ExecutionException {
		System.out.println("start...");
		Future<String> f = Executors.newFixedThreadPool(1).submit(new Callable<String>() {

			@Override
			public String call() throws Exception {
				Thread.sleep(3000);
				return "hello,message";
			}
		});
		Thread.sleep(3000);
		System.out.println("the other operation,block start");
		String msg = f.get();
		System.out.println("block over...");
		System.out.println(msg);
		System.out.println(f.isDone());
	}
	
}
